﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Snowflake.Entity
{
    /// <summary>
    /// Event arguments on chaning property
    /// </summary>
    public class PropertyChangingEventArgs: System.ComponentModel.PropertyChangingEventArgs
    {
        private object _CurrentValue;
        private object _NewValue;
        private bool _Cancel;

        internal PropertyChangingEventArgs(string propertyName, object oldValue, object newValue): base(propertyName)
        {
            this._CurrentValue = oldValue;
            this._NewValue = newValue;
            this._Cancel = false;
        }

        /// <summary>
        /// Current value of the property
        /// </summary>
        public object CurrentValue
        {
            get { return this._CurrentValue; }
        }

        /// <summary>
        /// New value of the property
        /// </summary>
        public object NewValue
        {
            get { return this._NewValue; }
        }

        /// <summary>
        /// Gets or sets a value wheather the event should be canceled
        /// </summary>
        public bool Cancel
        {
            get { return this._Cancel; }
            set { this._Cancel = value; }
        }
    }
}
